<template>
	<view class="unitRegister">
		<view class="unitRegister-title ff-font-25 ff-color-222 ff-font-weight-600">社会单位</view>
		<u-input height="88" placeholder="请输入单位社会信用代码" :custom-style="customStyle" v-model="codeList.organizationCode"
			border="true" />
		<view class="ff-margin-top-15 ff-margin-bottom-25">
			<u-input height="88" placeholder="请输入校验码" :custom-style="customStyle" v-model="codeList.checkCode"
				border="true" />
			<view class="ff-font-12 ff-line-height-1-5 ff-margin-top-7">单位无统一社会信用代码或营业执照代码，请联系客服提交相关材料，并申请校验码.</view>
		</view>
		<view class="ff-margin-top-20 unitRegister-but"><u-button type="primary" shape="circle"
				@click="nextClick">下一步</u-button></view>
		<f-loading ref="loading" />
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		name: 'unitRegisterOther',
		data() {
			return {
				customStyle: {
					'font-size': '30rpx'
				},
				codeList: {
					organizationCode: '', // 单位社会信用代码
					checkCode: '' // 校验码
				}
			};
		},
		methods: {
			// 点击下一步
			nextClick() {
				if (!this.codeList.organizationCode) {
					this.$refs.uToast.show({
						title: '请输入单位社会信用代码',
						type: 'error'
					});
					return;
				}
				if (!this.codeList.checkCode) {
					this.$refs.uToast.show({
						title: '请输入校验码',
						type: 'error'
					});
					return;
				}
				this.$refs.loading.openLoading('提交中···'); // 打开loading动画
				this.$http
					.post({
						url: `/sys/user/validOrganizationCodeV2`,
						data: this.codeList
					})
					.then(res => {
						// console.log('非正规社会信用代码校验结果----', res.data);
						if (res.data) {
							this.$refs.loading.closeLoading(); // 关闭loading动画
							this.$pageJump.navigateTo(
								'/pages/loginRegister/register/socialUnit/unit/unitRegisterResult?code=' + this
								.codeList.organizationCode);
						} else {
							this.$refs.loading.closeLoading(); // 关闭loading动画
							this.$refs.uToast.show({
								title: '单位代码或校验码无效',
								type: 'error'
							});
						}
					});
			}
		}
	};
</script>

<style lang="scss">
	page {
		background-color: #ffffff;
	}

	.unitRegister {
		padding: 130rpx 72rpx 56rpx 72rpx;

		&-title {
			margin-bottom: 52rpx;
		}

		.ff-line-height-1-5 {
			color: #ee0a24;
		}

		&-but {
			/deep/.u-size-default {
				height: 90rpx !important;
				line-height: 90rpx !important;
			}
		}
	}
</style>